| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 5 | |||
| 6 | export default class QueueMessage implements QueueAble { |
||
| 7 | |||
| 8 | private action: string; |
||
| 9 | |||
| 10 | private callback: CallableFunction; |
||
| 11 | |||
| 12 | private data: object|Array<object>; |
||
| 13 | |||
| 14 | private model: ModelInterface|ModelStaticInterface; |
||
| 15 | |||
| 16 | constructor(model: ModelInterface|ModelStaticInterface, action: string, data:object|Array<object>) { |
||
| 17 | this.model = model; |
||
| 18 | this.action = action; |
||
| 19 | this.data = data; |
||
| 20 | this.callback = () => null; |
||
| 21 | } |
||
| 22 | |||
| 23 | addCallback(callback: CallableFunction): void { |
||
| 24 | this.callback = callback; |
||
| 25 | } |
||
| 26 | |||
| 27 | execute(): void { |
||
| 28 | this.model[this.action](this.data); |
||
| 29 | this.callback(); |
||
| 30 | } |
||
| 31 | } |